\(\int \frac {c+d x}{(a+i a \tan (e+f x))^2} \, dx\) [26]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 151 \[ \int \frac {c+d x}{(a+i a \tan (e+f x))^2} \, dx=-\frac {3 i d x}{16 a^2 f}-\frac {d x^2}{8 a^2}+\frac {x (c+d x)}{4 a^2}+\frac {d}{16 f^2 (a+i a \tan (e+f x))^2}+\frac {i (c+d x)}{4 f (a+i a \tan (e+f x))^2}+\frac {3 d}{16 f^2 \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {i (c+d x)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )} \]

[Out]

-3/16*I*d*x/a^2/f-1/8*d*x^2/a^2+1/4*x*(d*x+c)/a^2+1/16*d/f^2/(a+I*a*tan(f*x+e))^2+1/4*I*(d*x+c)/f/(a+I*a*tan(f
*x+e))^2+3/16*d/f^2/(a^2+I*a^2*tan(f*x+e))+1/4*I*(d*x+c)/f/(a^2+I*a^2*tan(f*x+e))

Rubi [A] (verified)

Time = 0.18 (sec) , antiderivative size = 151, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3560, 8, 3811} \[ \int \frac {c+d x}{(a+i a \tan (e+f x))^2} \, dx=\frac {i (c+d x)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {x (c+d x)}{4 a^2}+\frac {3 d}{16 f^2 \left (a^2+i a^2 \tan (e+f x)\right )}-\frac {3 i d x}{16 a^2 f}-\frac {d x^2}{8 a^2}+\frac {i (c+d x)}{4 f (a+i a \tan (e+f x))^2}+\frac {d}{16 f^2 (a+i a \tan (e+f x))^2} \]

[In]

Int[(c + d*x)/(a + I*a*Tan[e + f*x])^2,x]

[Out]

(((-3*I)/16)*d*x)/(a^2*f) - (d*x^2)/(8*a^2) + (x*(c + d*x))/(4*a^2) + d/(16*f^2*(a + I*a*Tan[e + f*x])^2) + ((
I/4)*(c + d*x))/(f*(a + I*a*Tan[e + f*x])^2) + (3*d)/(16*f^2*(a^2 + I*a^2*Tan[e + f*x])) + ((I/4)*(c + d*x))/(
f*(a^2 + I*a^2*Tan[e + f*x]))

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3560

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[a*((a + b*Tan[c + d*x])^n/(2*b*d*n)), x] +
Dist[1/(2*a), Int[(a + b*Tan[c + d*x])^(n + 1), x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 + b^2, 0] && LtQ[n
, 0]

Rule 3811

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> With[{u = IntHide[(a
+ b*Tan[e + f*x])^n, x]}, Dist[(c + d*x)^m, u, x] - Dist[d*m, Int[Dist[(c + d*x)^(m - 1), u, x], x], x]] /; Fr
eeQ[{a, b, c, d, e, f}, x] && EqQ[a^2 + b^2, 0] && ILtQ[n, -1] && GtQ[m, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {x (c+d x)}{4 a^2}+\frac {i (c+d x)}{4 f (a+i a \tan (e+f x))^2}+\frac {i (c+d x)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}-d \int \left (\frac {x}{4 a^2}+\frac {i}{4 f (a+i a \tan (e+f x))^2}+\frac {i}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}\right ) \, dx \\ & = -\frac {d x^2}{8 a^2}+\frac {x (c+d x)}{4 a^2}+\frac {i (c+d x)}{4 f (a+i a \tan (e+f x))^2}+\frac {i (c+d x)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}-\frac {(i d) \int \frac {1}{(a+i a \tan (e+f x))^2} \, dx}{4 f}-\frac {(i d) \int \frac {1}{a^2+i a^2 \tan (e+f x)} \, dx}{4 f} \\ & = -\frac {d x^2}{8 a^2}+\frac {x (c+d x)}{4 a^2}+\frac {d}{16 f^2 (a+i a \tan (e+f x))^2}+\frac {i (c+d x)}{4 f (a+i a \tan (e+f x))^2}+\frac {d}{8 f^2 \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {i (c+d x)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}-\frac {(i d) \int 1 \, dx}{8 a^2 f}-\frac {(i d) \int \frac {1}{a+i a \tan (e+f x)} \, dx}{8 a f} \\ & = -\frac {i d x}{8 a^2 f}-\frac {d x^2}{8 a^2}+\frac {x (c+d x)}{4 a^2}+\frac {d}{16 f^2 (a+i a \tan (e+f x))^2}+\frac {i (c+d x)}{4 f (a+i a \tan (e+f x))^2}+\frac {3 d}{16 f^2 \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {i (c+d x)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}-\frac {(i d) \int 1 \, dx}{16 a^2 f} \\ & = -\frac {3 i d x}{16 a^2 f}-\frac {d x^2}{8 a^2}+\frac {x (c+d x)}{4 a^2}+\frac {d}{16 f^2 (a+i a \tan (e+f x))^2}+\frac {i (c+d x)}{4 f (a+i a \tan (e+f x))^2}+\frac {3 d}{16 f^2 \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {i (c+d x)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.07 (sec) , antiderivative size = 130, normalized size of antiderivative = 0.86 \[ \int \frac {c+d x}{(a+i a \tan (e+f x))^2} \, dx=-\frac {\sec ^2(e+f x) \left (8 (d+2 i c f+2 i d f x)+\left (4 c f (i+4 f x)+d \left (1+4 i f x+8 f^2 x^2\right )\right ) \cos (2 (e+f x))+\left (4 c f (1+4 i f x)+d \left (-i+4 f x+8 i f^2 x^2\right )\right ) \sin (2 (e+f x))\right )}{64 a^2 f^2 (-i+\tan (e+f x))^2} \]

[In]

Integrate[(c + d*x)/(a + I*a*Tan[e + f*x])^2,x]

[Out]

-1/64*(Sec[e + f*x]^2*(8*(d + (2*I)*c*f + (2*I)*d*f*x) + (4*c*f*(I + 4*f*x) + d*(1 + (4*I)*f*x + 8*f^2*x^2))*C
os[2*(e + f*x)] + (4*c*f*(1 + (4*I)*f*x) + d*(-I + 4*f*x + (8*I)*f^2*x^2))*Sin[2*(e + f*x)]))/(a^2*f^2*(-I + T
an[e + f*x])^2)

Maple [A] (verified)

Time = 0.80 (sec) , antiderivative size = 82, normalized size of antiderivative = 0.54

method result size
risch \(\frac {d \,x^{2}}{8 a^{2}}+\frac {c x}{4 a^{2}}+\frac {i \left (2 d f x +2 c f -i d \right ) {\mathrm e}^{-2 i \left (f x +e \right )}}{8 a^{2} f^{2}}+\frac {i \left (4 d f x +4 c f -i d \right ) {\mathrm e}^{-4 i \left (f x +e \right )}}{64 a^{2} f^{2}}\) \(82\)

[In]

int((d*x+c)/(a+I*a*tan(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

1/8*d*x^2/a^2+1/4/a^2*c*x+1/8*I*(2*d*f*x-I*d+2*c*f)/a^2/f^2*exp(-2*I*(f*x+e))+1/64*I*(4*d*f*x-I*d+4*c*f)/a^2/f
^2*exp(-4*I*(f*x+e))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 79, normalized size of antiderivative = 0.52 \[ \int \frac {c+d x}{(a+i a \tan (e+f x))^2} \, dx=\frac {{\left (4 i \, d f x + 4 i \, c f + 8 \, {\left (d f^{2} x^{2} + 2 \, c f^{2} x\right )} e^{\left (4 i \, f x + 4 i \, e\right )} - 8 \, {\left (-2 i \, d f x - 2 i \, c f - d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + d\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{64 \, a^{2} f^{2}} \]

[In]

integrate((d*x+c)/(a+I*a*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/64*(4*I*d*f*x + 4*I*c*f + 8*(d*f^2*x^2 + 2*c*f^2*x)*e^(4*I*f*x + 4*I*e) - 8*(-2*I*d*f*x - 2*I*c*f - d)*e^(2*
I*f*x + 2*I*e) + d)*e^(-4*I*f*x - 4*I*e)/(a^2*f^2)

Sympy [A] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 226, normalized size of antiderivative = 1.50 \[ \int \frac {c+d x}{(a+i a \tan (e+f x))^2} \, dx=\begin {cases} \frac {\left (\left (32 i a^{2} c f^{3} e^{2 i e} + 32 i a^{2} d f^{3} x e^{2 i e} + 8 a^{2} d f^{2} e^{2 i e}\right ) e^{- 4 i f x} + \left (128 i a^{2} c f^{3} e^{4 i e} + 128 i a^{2} d f^{3} x e^{4 i e} + 64 a^{2} d f^{2} e^{4 i e}\right ) e^{- 2 i f x}\right ) e^{- 6 i e}}{512 a^{4} f^{4}} & \text {for}\: a^{4} f^{4} e^{6 i e} \neq 0 \\\frac {x^{2} \cdot \left (2 d e^{2 i e} + d\right ) e^{- 4 i e}}{8 a^{2}} + \frac {x \left (2 c e^{2 i e} + c\right ) e^{- 4 i e}}{4 a^{2}} & \text {otherwise} \end {cases} + \frac {c x}{4 a^{2}} + \frac {d x^{2}}{8 a^{2}} \]

[In]

integrate((d*x+c)/(a+I*a*tan(f*x+e))**2,x)

[Out]

Piecewise((((32*I*a**2*c*f**3*exp(2*I*e) + 32*I*a**2*d*f**3*x*exp(2*I*e) + 8*a**2*d*f**2*exp(2*I*e))*exp(-4*I*
f*x) + (128*I*a**2*c*f**3*exp(4*I*e) + 128*I*a**2*d*f**3*x*exp(4*I*e) + 64*a**2*d*f**2*exp(4*I*e))*exp(-2*I*f*
x))*exp(-6*I*e)/(512*a**4*f**4), Ne(a**4*f**4*exp(6*I*e), 0)), (x**2*(2*d*exp(2*I*e) + d)*exp(-4*I*e)/(8*a**2)
 + x*(2*c*exp(2*I*e) + c)*exp(-4*I*e)/(4*a**2), True)) + c*x/(4*a**2) + d*x**2/(8*a**2)

Maxima [F(-2)]

Exception generated. \[ \int \frac {c+d x}{(a+i a \tan (e+f x))^2} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate((d*x+c)/(a+I*a*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negative exponent.

Giac [A] (verification not implemented)

none

Time = 0.42 (sec) , antiderivative size = 101, normalized size of antiderivative = 0.67 \[ \int \frac {c+d x}{(a+i a \tan (e+f x))^2} \, dx=\frac {{\left (8 \, d f^{2} x^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + 16 \, c f^{2} x e^{\left (4 i \, f x + 4 i \, e\right )} + 16 i \, d f x e^{\left (2 i \, f x + 2 i \, e\right )} + 4 i \, d f x + 16 i \, c f e^{\left (2 i \, f x + 2 i \, e\right )} + 4 i \, c f + 8 \, d e^{\left (2 i \, f x + 2 i \, e\right )} + d\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{64 \, a^{2} f^{2}} \]

[In]

integrate((d*x+c)/(a+I*a*tan(f*x+e))^2,x, algorithm="giac")

[Out]

1/64*(8*d*f^2*x^2*e^(4*I*f*x + 4*I*e) + 16*c*f^2*x*e^(4*I*f*x + 4*I*e) + 16*I*d*f*x*e^(2*I*f*x + 2*I*e) + 4*I*
d*f*x + 16*I*c*f*e^(2*I*f*x + 2*I*e) + 4*I*c*f + 8*d*e^(2*I*f*x + 2*I*e) + d)*e^(-4*I*f*x - 4*I*e)/(a^2*f^2)

Mupad [B] (verification not implemented)

Time = 3.13 (sec) , antiderivative size = 103, normalized size of antiderivative = 0.68 \[ \int \frac {c+d x}{(a+i a \tan (e+f x))^2} \, dx=\frac {d\,x^2}{8\,a^2}-{\mathrm {e}}^{-e\,4{}\mathrm {i}-f\,x\,4{}\mathrm {i}}\,\left (\frac {\left (-4\,c\,f+d\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{64\,a^2\,f^2}-\frac {d\,x\,1{}\mathrm {i}}{16\,a^2\,f}\right )-{\mathrm {e}}^{-e\,2{}\mathrm {i}-f\,x\,2{}\mathrm {i}}\,\left (\frac {\left (-2\,c\,f+d\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{8\,a^2\,f^2}-\frac {d\,x\,1{}\mathrm {i}}{4\,a^2\,f}\right )+\frac {c\,x}{4\,a^2} \]

[In]

int((c + d*x)/(a + a*tan(e + f*x)*1i)^2,x)

[Out]

(d*x^2)/(8*a^2) - exp(- e*4i - f*x*4i)*(((d*1i - 4*c*f)*1i)/(64*a^2*f^2) - (d*x*1i)/(16*a^2*f)) - exp(- e*2i -
 f*x*2i)*(((d*1i - 2*c*f)*1i)/(8*a^2*f^2) - (d*x*1i)/(4*a^2*f)) + (c*x)/(4*a^2)